<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">

	<title>登录 - DQ - Thousands Download</title>
	<style>
		/* 让图片稍微往左移 */
		.main-title img {
			margin-left: -18px;  /* 向左移动18像素 */
		}
	</style>
	<link rel="stylesheet" type="text/css" href="style/register-login.css">
</head>
<body>
<div id="box"></div>
<div class="cent-box">
	<div class="cent-box-header">
		<h1 class="main-title hide">
		    <img src="images/login.png" alt="DQ Logo" width="200" height="100">

		</h1>
		<h2 class="sub-title">分享 - Thousands of Downloads</h2>
	</div>
	<div class="cont-main clearfix">
		<div class="index-tab">
			<div class="index-slide-nav">
				<a href="login.html" class="active">登录</a>
				<div class="slide-bar"></div>				
			</div>
		</div>

		<div class="login form">
			<div class="group">
				<div class="group-ipt email">
					<input type="text" name="user" id="user" class="ipt" placeholder="输入您的用户名" required>
				</div>
				<div class="group-ipt password">
					<input type="password" name="password" id="password" class="ipt" placeholder="输入您的登录密码" required>
				</div>
				<div class="group-ipt verify">
					<input type="text" name="verify" id="verify" class="ipt" placeholder="输入验证码" required>
					<img src="images/1.png" class="imgcode">
				</div>
			</div>
		</div>

		<div class="button">
			<button  class="login-btn register-btn" id="button">登录</button>
		</div>

		<div class="remember clearfix">
			<label class="remember-me"><span class="icon"><span class="zt"></span></span><input type="checkbox" name="remember-me" id="remember-me" class="remember-mecheck" checked>记住我</label>
			<label class="forgot-password">
				<a href="#">忘记密码？</a>
			</label>
		</div>
	</div>
</div>

<div class="footer">
	<p>DQ - Committed to tens of thousands of downloads</p>
	<p>Designed   & <a href="zrong.me">mycodes</a> 2025</p>
</div>

<script src='js/particles.js' type="text/javascript"></script>
<script src='js/background.js' type="text/javascript"></script>
<script src='js/jquery.min.js' type="text/javascript"></script>
<script src='js/layer/layer.js' type="text/javascript"></script>
<script src='js/index.js' type="text/javascript"></script>
<script>
    // 固定账号列表
    const accounts = [
        { username: 'ws', password: '123' },
        { username: 'ljc', password: '123' },
        { username: 'hky', password: '123' }
    ];

    // 点击登录按钮时的验证逻辑
    $("#button").click(function(){
        var username = $("#user").val();  // 获取输入的用户名
        var password = $("#password").val();  // 获取输入的密码
        var verify = $("#verify").val();  // 获取输入的验证码

        // 验证验证码
        if(verify !== '223'){
            alert("验证码错误！");
            return;
        }

        // 检查是否匹配固定账号
        let validAccount = false;
        for (let i = 0; i < accounts.length; i++) {
            if (accounts[i].username === username && accounts[i].password === password) {
                validAccount = true;
                break;
            }
        }

        if (validAccount) {
			// 登录成功，跳转到下载页面
			window.location.href = "download.html";
		} else {
			alert("用户名或密码错误！");
			window.location.href = "defult.html";  // 登录失败，跳转到失败页面
		}
    });
</script>
</body>
</html>